// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   TxZJ.java

package com.tool.tcpimg;

import com.tool.tcp.*;
import come.tool.Fighting.sidian;
import java.awt.Graphics;
import org.come.bean.Mapmodel;
import org.come.bean.PathPoint;
import org.come.until.Util;

public class TxZJ
{

	private String skin;
	private int jg;
	private sidian sidians[];

	public TxZJ(String skin)
	{
		this.skin = skin;
		sidians = new sidian[5];
		for (int i = 0; i < sidians.length; i++) {
            sidians[i] = new sidian(-1, 0, 0, 0);
        }

		jg = 30;
	}

	public void draw(Graphics g, long time)
	{
		time = (long)((double)time * 1.5D);
		Sprite sprite = null;
		for (int i = 0; i < sidians.length; i++)
		{
			if (i == 0) {
                sprite = SpriteFactory.Prepare(GetTcpPath.getMouseTcp(skin));
            }
			if (sidians[i].getX() != -1)
			{
				sidians[i].setX((int)((long)sidians[i].getX() + time));
				if (sprite != null) {
                    if (sidians[i].getX() <= sprite.getTime())
                    {
                        PathPoint pathPoint = Util.mapmodel.path(sidians[i].getZ(), sidians[i].getW());
                        if (pathPoint != null)
                        {
                            sprite.updateToTime(sidians[i].getX(), sidians[i].getY());
                            sprite.draw(g, pathPoint.getX(), pathPoint.getY());
                        }
                    } else
                    {
                        sidians[i].setX(-1);
                    }
                }
			}
		}

	}

	public void addZJ(int x, int y, int dir)
	{
		if (Util.mapmodel.path(x, y) == null) {
            return;
        }
		for (int i = 0; i < sidians.length; i++) {
            if (sidians[i].getX() == -1)
            {
                jg--;
                if (jg < 0)
                {
                    jg = 30;
                    sidians[i].setsidian(0, dir, x, y);
                }
                return;
            }
        }

	}

	public void setSkin(String skin)
	{
		this.skin = skin;
	}
}
